<?php

class action_userManagementLogUser extends action{
	protected function init(){
		$this->template = 'actions/userManagementLogUser.tpl';
		$this->no_base = true;
	}
	
	public function process($data=null){
		if(empty($_GET['user_id'])) throw new Exception('NO USER ID GIVEM', 500);
		
		
		$sql = <<<eol
SELECT
	user_log.user_log_id,
	user_log.user_id,
	user_log.from_user_id,
	users.name as from_name,
	users.loginname as from_loginname,
	user_log.from_ip,
	user_log.log_type,
	user_log.time_created,
	user_log.message
FROM
	user_log
	LEFT JOIN users ON user_log.from_user_id=users.user_id
eol;
		
		$logs = $this->db->getAssoc($sql);
		
		$this->assign('logs', $logs);
	}
	
	public function hasAccess(){
		return umUser::getInstance()->isAdministrator();
	}
}
